# Contributor: Díaz Urbaneja Diego <sodomon2@gmail.com>
# Maintainer: Díaz Urbaneja Diego <sodomon2@gmail.com>
pkgname=warzone2100
pkgver=3.4.1
pkgrel=0
pkgdesc="3D realtime strategy game on a future Earth"
url="https://wz2100.net/"
arch="x86_64" # only available x86_64 for compiling problems
license="GPL-1.0-only"
depends="
	ttf-dejavu
	xrandr
	"
makedepends="
	sdl2-dev
	glew-dev
	fribidi-dev
	openal-soft-dev
	libvorbis-dev
	libtheora-dev
	physfs-dev
	qt5-qtscript-dev
	libsodium-dev
	gawk
	flex
	zip
	unzip
	asciidoc
	mesa
	cmake
	harfbuzz-dev
	freetype-dev
	libpng-dev
	sqlite-dev
	curl-dev
	"
subpackages="$pkgname-doc $pkgname-lang"
source="$pkgname-$pkgver.tar.xz::https://github.com/Warzone2100/warzone2100/releases/download/$pkgver/warzone2100_src.tar.xz"
builddir="$srcdir/warzone2100"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DWZ_DISTRIBUTOR="AlpineLinux" \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="26c026400e418ed3da94d96e7bb443c765ede3e0b347785ff8a9e687a5ad87afe03012c830fd509b927634484687efac951b2ef3417e7fe027ce0e684561ca84  warzone2100-3.4.1.tar.xz"
